﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InCom.Core.TerminalSend.MappedFile
{
    /// <summary>
    /// 持久化状态数据
    /// </summary>
    public class PersistenceStatus
    {
        #region 构造涵数
        /// <summary>
        /// 构造函数
        /// </summary>
        public PersistenceStatus()
        {
            summary = Factory.Instance.CreateMString(512);
            currentIndex = Factory.Instance.CreateMLong();
            diskFileName = Factory.Instance.CreateMString(512);
            tagName = Factory.Instance.CreateMString(250);
            lastActionTime = Factory.Instance.CreateMDateTime();
            isComplated = Factory.Instance.CreateMBool();
            fileNumber = Factory.Instance.CreateMInt();
            userFlag = Factory.Instance.CreateMString(120);
        }

        #endregion


        private MString summary;
        /// <summary>
        /// 说明描述 最大512字符
        /// </summary>
        public string Summary
        {
            get { return summary.Value; }
            set { summary.Value = value; }
        }

        private MLong currentIndex;
        /// <summary>
        /// 当前读取索引
        /// </summary>
        public long CurrentIndex
        {
            get { return currentIndex.Value; }
            set { currentIndex.Value = value; }
        }

        private MString diskFileName;
        /// <summary>
        /// 持久化文件名
        /// </summary>
        public string DiskFileName
        {
            get { return diskFileName.Value; }
            set { diskFileName.Value = value; }
        }


        private MString tagName;
        /// <summary>
        /// 发送目标节点名
        /// </summary>
        public string TagName
        {
            get { return tagName.Value; }
            set { tagName.Value = value; }
        }

        private MDateTime lastActionTime;
        /// <summary>
        /// 最后动作时间
        /// </summary>
        public DateTime LastActionTime
        {
            get { return lastActionTime.Value; }
            set { lastActionTime.Value = value; }
        }


        private MBool isComplated;
        /// <summary>
        /// 是否已经完成
        /// </summary>
        public bool IsComplated
        {
            get { return isComplated.Value; }
            set { isComplated.Value = value; }
        }

        private MInt fileNumber;
        /// <summary>
        /// 文件编号
        /// </summary>
        internal int FileNumber
        {
            get { return fileNumber.Value; }
            set { fileNumber.Value = value; }
        }


        private MString userFlag;
        /// <summary>
        /// 用户标识 120个字符以内
        /// </summary>
        public string UserFlag
        {
            get { return userFlag.Value; }
            set { userFlag.Value = value; }
        }

        private FileStreamWriteRead fileReadWrite;
        /// <summary>
        /// 文件读写对像
        /// </summary>
        public FileStreamWriteRead FileReadWrite
        {
            get { return fileReadWrite; }
            set { fileReadWrite = value; }
        }
        /// <summary>
        /// 补发数据缓冲区
        /// </summary>
        internal SendTagsBuffer ReissueTagBuff { get; set; }
    }
}
